<?php

/**
 * @class user-class
 * @desc provides information about the user
 */
class fiasco_user{

	protected $loggedin = false;
	
	/**
	 * on creation, verifies user
	 * @param username of user
	 * @return true if user is found otherwise it throws a error
	 */
	public function __construct($username = ""){
		if (!defined('SESSION_LOADED')) {
			session_name(SITENAME);
			session_start();	
			define('SESSION_LOADED');
		}
		if (isset($_SESSION['user']) && empty($username)) {
			$this->loggedin = true;
			$this->load_user($_SESSION['user']);
		} else {
			$this->load_user($username);
		}
	}

	public function is_logged_in(){
		return $this->loggedin;
	}

	public function load_user($user = array()){
		if (is_array($user) and !empty($user) && isset($user['username'])) {
			foreach ($user as $key => $value) {
				$this->$key = $value;
			}	
		}
		if (is_string($user)) {
			$rs = 		
		}
	}

}
